import Request from "@/business/Request";
export async function getAuth(){
    const result=await Request.get("users/captcha");
    return {data:result.data,captcha:result.headers["x-captcha"]}
}
export async function authcaptcha(captcha:string,headersCaptcha:string){
    const result=await Request.post("users/authcaptcha",{captcha},{headers:{"X-Captcha":headersCaptcha}})
    if(result.errno===0){
        return {code:0,data:result.data.result,captcha:result.headers["x-captcha"]}
    }else{
        return {code:1}
    }
}

export async function login(body:{username:string,password:string}){
    const result=await Request.post("user/login",{...body});
    return result.data;
}